﻿using AutoMapper;
using JXC.Application.Dtos;
using JXC.Core.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace JXC.WebAPI.Profiles
{
    public class PlanDetailProfile : Profile
    {
        public PlanDetailProfile()
        {
            CreateMap<PlanDetailDto, PlanDetail>();
            CreateMap<PlanDetail, PlanDetailDto>()
                .ForMember(dest => dest.ProductName, opt => { opt.MapFrom(src => src.CommodityInformationSheet.ProductName); })
                .ForMember(dest => dest.Model, opt => { opt.MapFrom(src => src.CommodityInformationSheet.Model); })
                .ForMember(dest => dest.Units, opt => { opt.MapFrom(src => src.CommodityInformationSheet.Units); })
                .ForMember(dest => dest.UnitPrice, opt => { opt.MapFrom(src => src.CommodityInformationSheet.UnitPriceOfWarehousingPlan); })
                .ForMember(dest => dest.TheOriginalInventory, opt => { opt.MapFrom(src => src.CommodityInformationSheet.TheOriginalInventory); })
                ;
        }
    }
}
